<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>查询工作报告列表</title>
		<!-- css代码 start -->
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<link href="../../../css/global.css" rel="stylesheet" />
		<link href="../../../css/style.css" rel="stylesheet" />
		<link href="../../../css/task.css" rel="stylesheet" />
		<style>
		
			.mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{
				top: 8px;
				right: -10px;
			}
			
			.details_con{
				background: #fff;
			}
			input.d_ipt{
				width: 60%;
				background: #fff;
			}
			.mui-btn-block{
				border: 0;
				font-size: 16px;
				color: #a9a9a9;
			}
			
		</style>
		<!-- css代码 end -->
	</head>
	<body>
		
	
		<!-- html代码 start -->
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">查询工作报告列表</h1>
		</header>
		<div class="mui-content">
			<div class="page_cen shadow title_num" id="dianji">服务通知编号：<span id="serviceNo" style="color: #ea1e1a;"></span></div>
			<div class="item_box" id="itemBox">
				
			</div>
			
		</div>
		<!-- html代码 end -->

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">
			function getNewStr(str) {
				if (JS.IsNullOrEmpty(str)) {
					return '';
				}
				return str;
			}
			
			//报告类型（1=服务报告，2=Error Report，3=Hot Account Reprot，4=验收报告，5=安装质量报告，6=电话解决报告）
			function preview(serviceNo, relServiceNo, reportId, reportNo) {
				console.log({serviceNo, relServiceNo, reportId, reportNo})
				if (relServiceNo == '1') {
					app.jumpTo('/view/service/report/preview/fuwunr.html', 'view/service/report/preview/fuwunr.html', {
						serviceNo,
						reportId,
						reportNo
					})
				}
				
				if (relServiceNo == '5') {
					app.jumpTo('/view/service/report/preview/baogaonr.html', 'view/service/report/preview/baogaonr.html', {
						serviceNo,
						reportId,
						reportNo
					})
				}
				
				if (relServiceNo == '4') {
					app.jumpTo('/view/service/report/preview/yanshounr.html', 'view/service/report/preview/yanshounr.html', {
						serviceNo,
						reportId,
						reportNo
					})
				}
				
			}
			
			var serviceNo;
			var prev;
			(function($, doc) {
				
				$.init();

				$.plusReady(function() {
					
					var self = plus.webview.currentWebview();
					
					serviceNo = self.serviceNo;
					prev = self.prev;
					
					h('#serviceNo').html(serviceNo);
						app.showWaiting()
						ajaxGet(BASE_URL + "cc/report/info/getCustomerSignList", {
							"serviceNo": serviceNo
						}, function(data) {
							app.closeWaiting()
							if (data.code === 200) {
								var str = '';
								 if(data.data && data.data.length > 0){
									 for(var c = 0;c<data.data.length;c++){
										
										var info = data.data[c];
										
										var relServiceNo = data.data[c].relServiceNo;
										
										if(relServiceNo == '2' || relServiceNo == '3'){
											continue;
										}
										var previewBtn='<span class="yulan" onclick="preview('+info.serviceNo+','+info.relServiceNo+','+info.id+','+info.reportNo+')">预览</span>'
										if (relServiceNo == '6'){
											previewBtn=''
										}
										str += '<div class="item">';
										str += '<div class="bar">';
										str += previewBtn;
										str += '<span class="number">'+data.data[c].id+'<img src="../../../images/icon_204.png" /></span>';
										str += '</div>';
										str += '<div class="type">';
										str += '<p><img src="../../../images/icon_219.png"/><div class="lpl">FSE：</div><span>'+ getNewStr(data.data[c].fseName) +'</span></p>';
										str += '<p><img src="../../../images/icon_201.png"/><div class="lpl">客户名称：</div><span>'+ getNewStr(data.data[c].customerName) +'</span></p>';
										str += '<div style="clear: both"></div>';
										relServiceNo = data.data[c].relServiceNo;
										//报告类型（1=服务报告，2=Error Report，3=Hot Account Reprot，4=验收报告，5=安装质量报告，6=电话解决报告）
										if (relServiceNo == '1') {
											relServiceName = "服务报告";
										} else if (relServiceNo == '2') {
											relServiceName = "Error Report";
										} else if (relServiceNo == '3') {
											relServiceName = "Hot Account Reprot";
										} else if (relServiceNo == '4') {
											relServiceName = "验收报告";
										} else if (relServiceNo == '5') {
											relServiceName = "安装质量报告";
										} else if (relServiceNo == '6') {
											relServiceName = "电话解决报告";
										}
										str += '<p><img src="../../../images/icon_203.png"/><div class="lpl">报告类型：</div><span>'+ relServiceName +'</span></p>';
										// str += '<p><img src="../../../images/icon_217.png"/><div class="lpl">仪器型号：</div><span>'+ instrumentNo +'</span></p>'
										var serviceResult = data.data[c].serviceResult
										if (JS.IsNullOrEmpty(serviceResult)) {
											serviceResult = "暂无"
										} else if(serviceResult == '1') {
											serviceResult = "完成"
										} else if(serviceResult == '2'){
											serviceResult = '未完成'
										}
										str += '<p><img src="../../../images/icon_222.png"/><div class="lpl">服务结果：</div><span>'+ serviceResult +'</span></p>';
										str += '</div></div>';
									 }
									 h('#itemBox').html(str);
								 }else{
									 var html = '<div class="nodata">—— 暂无数据 ——</div>';
									 h("#itemBox").html(html);
								 }
								 
							} else {
								var html = '<div class="nodata">—— 暂无数据 ——</div>';
								h("#itemBox").html(html);
								app.toast(data.msg);
							}
						}, function(errorMsg) {
							app.closeWaiting()
							var html = '<div class="nodata">—— 暂无数据 ——</div>';
							h("#itemBox").html(html);
							app.toast("数据获取失败，请检查网络连接");
						});
							
				});
			}(mui, document));

			h("#dianji").tap(function(){
				app.jumpTo("/view/workArea/service/serveDetails.html", "view/workArea/service/serveDetails.html", {
					"serviceNo": serviceNo,
					"enginnerId": app.getUser().enginnerId,
					prev: prev
				})
			})
			
		</script>
		<!-- js代码 end -->
	</body>
</html>
